package net.xo68.destiny.contract.enums.handler;

/**
 * worker任务处理状态枚举
 * @author wuxie
 * @version 2020-11-4
 */
public enum JobHandleStateEnum {

    /**
     * 初始化
     */
    INIT(0),
    /**
     * 成功
     */
    SUCCESS(1),
    /**
     * 结束
     */
    FAIL(2);

    private final int state;

    JobHandleStateEnum(int state) {
        this.state = state;
    }

    public int getState() {
        return state;
    }

    public static JobHandleStateEnum of(int state){
        for (JobHandleStateEnum item: JobHandleStateEnum.values()) {
            if (item.getState()== state) {
                return item;
            }
        }
        return null;
    }
}
